<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <title>申请物料</title>
    <link rel="stylesheet" href="../css/mui.min.css">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <script src="../js/mui.min.js"></script>
    <script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../js/cookieutil.js" type="text/javascript" charset="utf-8"></script>
    <script src="../js/getUrlParam.js"></script>
    <style>
        label{
            font-size: 12px!important;
        }
         input{
            font-size: 12px!important;
        }
    </style>
</head>
<div class="mui-content" >
    <div class="headage"></div>
    <div class="mui-content-padded" style="height: 120px">
        <img src="../images/sqwul.png" style="width:100%;text-align: center;height: 120px;"/>
    </div>

    <div class="container">
        <form class="mui-input-group">
            <div class="mui-input-row ">
                <label>收货人:</label>
                <input type="text" class=" mui-input-clear" placeholder="" id="Nickname">
            </div>
            <div class="mui-input-row ">
                <label>联系电话:</label>
                <input type="text" class=" mui-input-clear" placeholder="" id="phone">
            </div>
            <div class="mui-input-row ">
                <label>收货地址:</label>
                <input type="text" class=" mui-input-clear" placeholder="" id="address">
            </div>

        </form>
        <div class="container" style="margin-top: 15px;">
            <form class="mui-input-group">
                <div class="mui-input-row ">
                    <label style="width: 45%">局部体验材料:</label>
                <div class="mui-numbox" data-numbox-step='1' data-numbox-min='0' data-numbox-max='100' style="width: 140px!important;">
                    <button class="mui-btn mui-numbox-btn-minus" type="button">-</button>
                    <input class="mui-numbox-input" type="number" id="WuliaoA"/>
                    <button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
                </div>
                </div>
                <div class="mui-input-row " >
                    <label style="width: 45%">签约祛斑材料:</label>
                <div class="mui-numbox" data-numbox-step='1' data-numbox-min='0' data-numbox-max='100' style="width: 140px!important";>
                    <button class="mui-btn mui-numbox-btn-minus" type="button">-</button>
                    <input class="mui-numbox-input" type="number" id="WuliaoB"/>
                    <button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
                </div>
                </div>
            </form>

        <div style="width: 100%;">
            <button type="button" class="mui-btn mui-btn-primary" id="saveWuliao"  style="width: 80%;height: 35px;float: left;margin-left: 10%;margin-top: 20px;">申请物料</button>
        </div>
    </div>

    <div class="footerpage">
    </div>
</div>
</div>
</body>


<script>
    $(function(){
        $(".headage").load("head.html");
        $(".footerpage").load("footer.html");
        /*公共部分
         * 导航栏
         * footer CopyRight
         */

        var  userid=getCookie('userid');
        if (userid==null||userid==undefined)
        {
            getindex();
        }else {
            $("#saveWuliao").click(function () {

                var phone = $("#phone").val();
                var address = $("#address").val();
                var Nickname = $("#Nickname").val();
                if (Nickname == "" || Nickname == undefined) {
                    mui.toast('请输入收货人！');
                    return;
                }
                if (phone == "" || phone == undefined) {
                    mui.toast('请输入你的联系电话！');
                    return;
                } else {
                    var t = Isphone(phone);
                    if (t == false) {
                        mui.toast('联系电话格式不对！');
                        return;
                    }
                }
                if (address == "" || address == undefined) {
                    mui.toast('请输入你的联系地址！');
                    return;
                }
                var WuliaoA = $("#WuliaoA").val();
                var WuliaoB = $("#WuliaoB").val();
                if ((WuliaoA==undefined||WuliaoA==null||WuliaoA==0)&&(WuliaoB==undefined||WuliaoB==null||WuliaoB==0))
                {
                    mui.toast('请至少选择一种物料！');
                    return;
                }
                mui.post('/Wuliao/insert',
                    {
                        userid: userid,
                        Nickname: Nickname,
                        WuliaoA: WuliaoA,
                        WuliaoB: WuliaoB,
                        phone: phone,
                        address: address
                    },
                    function (data) {
                        console.log(data);
                        if (data.code) {

                            mui.toast('提交成功请你等待发货！');
                            window.history.back(-1);
                        }
                    }, 'json'
                )
            });
        }
    });
</script>

